﻿@model NewsItemModel

@using Telerik.Web.Mvc.UI;
@using SmartStore.Web.Framework.UI;

@Html.ValidationSummary(false)
@Html.HiddenFor(model => model.Id)

@Html.SmartStore().TabStrip().Name("news-edit").Style(TabsStyle.Material).Position(TabsPosition.Top).Items(x =>
{
	x.Add().Text(T("Admin.Common.Info").Text).Content(TabInfo()).Selected(true);
    x.Add().Text(T("Admin.Common.SEO").Text).Content(TabSeo());
	x.Add().Text(T("Admin.Common.Stores").Text).Content(TabStores());

    //generate an event
	EngineContext.Current.Resolve<IEventPublisher>().Publish(new TabStripCreated(x, "news-edit", this.Html, this.Model));
})

@helper TabInfo()
{
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.LanguageId)
            </td>
            <td class="adminData">
                @Html.DropDownListFor(model => model.LanguageId, new SelectList(ViewBag.AllLanguages, "Id", "Name"))
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.Title)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.Title)
                @Html.ValidationMessageFor(model => model.Title)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.Short)
            </td>
            <td class="adminData">
                @Html.TextAreaFor(model => model.Short)
                @Html.ValidationMessageFor(model => model.Short)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.Full)
            </td>
            <td class="adminData wide">
                @Html.EditorFor(x => x.Full, "Html")
                @Html.ValidationMessageFor(model => model.Full)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.AllowComments)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AllowComments)
                @Html.ValidationMessageFor(model => model.AllowComments)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.StartDate)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.StartDate)
                @Html.ValidationMessageFor(model => model.StartDate)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.EndDate)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.EndDate)
                @Html.ValidationMessageFor(model => model.EndDate)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.Published)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.Published)
                @Html.ValidationMessageFor(model => model.Published)
            </td>
        </tr>
    </table>
}

@helper TabSeo()
{
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MetaKeywords)
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.MetaKeywords)
                @Html.ValidationMessageFor(model => model.MetaKeywords)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MetaDescription)
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.MetaDescription)
                @Html.ValidationMessageFor(model => model.MetaDescription)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MetaTitle)
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.MetaTitle)
                @Html.ValidationMessageFor(model => model.MetaTitle)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.SeName)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.SeName)
				@if (Model.Id != 0)
                {
                    @Html.Action("NamesPerEntity", "UrlRecord", new { entityName = "NewsItem", entityId = Model.Id })
                }
                @Html.ValidationMessageFor(model => model.SeName)
            </td>
        </tr>
    </table>
}

@helper TabStores()
{
	@Html.Partial("StoreSelector", Model)
}

